package protobuf;

import db.UserResult;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtostuffIOUtil;
import io.protostuff.runtime.RuntimeSchema;

import java.util.Base64;

public class PTest1 {

    public void protostuffTest() {
        UserResult po = new UserResult();
        po.setLoginName("aaaa");
        po.setPassword("bbbbb");
        po.setId(1L);
        byte[] bytes = ProtostuffUtils.serialize(po);
        System.out.println(Base64.getEncoder().encodeToString(bytes));
        System.out.println(bytes.length);
        UserResult newPo = ProtostuffUtils.deserialize(bytes, UserResult.class);
        System.out.println(newPo);
    }

    public static void main(String[] args) {
        PTest1 t = new PTest1();
        t.protostuffTest();
    }
}
